
//  UIImageView+extension.swift

//  Created by laichunhui on 15/9/30.
//  Copyright © 2015年 lch. All rights reserved.

//  对UIImageView的扩展

import UIKit

extension UIImageView {
    /// 包装SDWeb框架的图片加载方法
    func xs_setImageWithURL(url: NSURL, placeholderImage: UIImage) {
        self.sd_setImageWithURL(url, placeholderImage: placeholderImage)
    }
    /// 包装SDWeb加载圆形头像
    func xs_setCircleIconViewWithURL(url: NSURL) {
        let placeholder = UIImage(named: "avatar_default_big")?.imageClipOvalImage()
    
        self.sd_setImageWithURL(url, placeholderImage: placeholder) { (image, error, _, _) -> Void in

            self.image = image == nil ? placeholder : image.imageClipOvalImage()
        }
    }
}
